﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThinhTien.EF4;

namespace ThinhTien.Data.Repository
{
    public class LookupRepository : BaseRepository<LookupRepository>
    {
        public KeyValuePair<Guid, string>[] GetDataLookup(string type)
        {
            var results = new List<KeyValuePair<Guid, string>>();

            using (var db = new THINHTIENDBEntities())
            {
                var query = (from item in db.Lookups
                             where item.FunctionName == type
                             select item).ToList();

                foreach (var item in query)
                {
                    results.Add(new KeyValuePair<Guid, string>(item.ID, item.Name));
                }
            }

            return results.ToArray();
        }
    }
}
